<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Sanity Check Report</title>
    <script type="text/javascript" src="sorttable.js"></script>
    <style type="text/css">
        body { margin-left: 2%; margin-right: 2%; font:normal verdana,arial,helvetica; color:#000000; }
        table.sortable tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.sortable tr td { background:#eeeee0; }
        table.classcount tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.classcount tr td { background:#eeeee0; }
        table.summary tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.summary tr td { background:#eeeee0; text-align:center;}
        .p1 { background:#FF9999; }
        .p2 { background:#FFCC66; }
        .p3 { background:#FFFF99; }
        .p4 { background:#99FF99; }
        .p5 { background:#9999FF; }
    div.top{text-align:right;margin:1em 0;padding:0}
    div.top div{display:inline;white-space:nowrap}
    div.top div.left{float:left}
    #content>div.top{display:table;width:100%}
    #content>div.top div{display:table-cell}
    #content>div.top div.left{float:none;text-align:left}
    #content>div.top div.right{text-align:right}
    </style>
  </head>
  <body>
    <H1>
      <div class="top">
        <div class="left">MyIsern 1.3 Report</div>
        <div class="right">${actionBean.time}</div>
      </div>
    </H1>
    <stripes:form id="FilterForm" action="/MyIsern.action">
        Filter: 
          <stripes:select size="1" name="filterSetting">
            <stripes:option value="all">All</stripes:option>
            <stripes:option value="researchers">Researchers</stripes:option>
            <stripes:option value="organizations">Organizations</stripes:option>
            <stripes:option value="collaborations">Collaborations</stripes:option>
          </stripes:select>
          <stripes:submit value="Filter" name="filterReport"/>

          </stripes:form>
    <hr>
    <table border="0" width="100%" class="sortable" id="sortable_id_1">
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th align="left">Errors</th>
      </tr>
      <%int count = 0;%>
      <stripes:form id="Filter2Form" action="/MyIsern.action">
      <c:forEach var="element" items="${actionBean.reportIterator}">
        <c:if test="${
          (element.type == \"Researcher\" && actionBean.checkResearchers) ||  
          (element.type == \"Organization\" && actionBean.checkOrganizations) ||
          (element.type == \"Collaboration\" && actionBean.checkCollaborations)
        }">
        
          <c:if test="${element.numErrors > 0}">
             <%count++;%>
             <tr>
               <td style="padding: 3px" align="right">
                <c:if test="${element.type == \"Researcher\"}">
                  <div class="p1">
                </c:if>
                <c:if test="${element.type == \"Organization\"}">
                  <div class="p3">
                </c:if>
                <c:if test="${element.type == \"Collaboration\"}">
                  <div class="p5">
                </c:if>
                   ${element.type}
                 </div>
               </td>
               <td style="padding: 3px" align="left" width = "20%">
                  ${element.name}
               </td>
               <td style="padding: 3px" align="left" width="100%">
                 <table border="0" width="100%" class="sortable" id="sortable_id_2">
                   <c:forEach var="errorItem" items="${element.errorList}">
                     <tr><td>${errorItem}</td></tr>
                   </c:forEach>
                 </table>
               </td>
             </tr>
           </c:if>
        </c:if>
      </c:forEach>
      </stripes:form>
    </table>
    <table border="0" width="100%" class="classcount">
      <tr>
      <th>Total number of violations: <%=count%></th>
      </tr>
    </table>
    <br>
    <p>Generated by <a href="http://code.google.com/p/myisern-1-orange/">
      MyIsern-1-Orange <b>1.3</b></a> on ${actionBean.time}.</p>
  
  </body>
</html>

